package com.ffyc.cms.service;

import com.ffyc.cms.dao.NewsDao;
import com.ffyc.cms.model.News;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class NewsService {
    @Autowired
    NewsDao newsDao;
    public List<News> getnewsList(Integer id){
        return newsDao.getnewsList(id);
    }

    public News getnewscontent(Integer id) {
        return newsDao.newscontent(id);
    }

    /*按关键字查询出数据库中的新闻*/
    public List<News> serch(News news) {
        return newsDao.serch(news);
    }

    /*查询出点击最多的新闻*/
    public List<News> getmaxpraise() {
        return newsDao.getmaxpraise();
    }

    /*查询出点赞最多的新闻*/
    public List<News> getmaxlike() {
        return newsDao.getmaxlike();
    }
    /*查询出点赞最多的新闻的封面*/
    public List<News> getimglist() {
       return newsDao.getimglist();
    }

    /*查询出最新发布的新闻的封面*/
    public List<News> getlatestnews() {
        return newsDao.getlatestnews();
    }
}
